#include <stdio.h>
#include <SGE.h>
using namespace SGE;

SGE_Sprite sprite;
SVector2 position;
bool quit = false;

void SGE_Initialize()
{
	sprite.Load("sonic.jpg");
}

void SGE_Terminate()
{
	sprite.Unload();
}

bool SGE_Update(float deltaTime)
{
	const float Kspeed = 100.0f;

	if(Input_IsKeyDown(Keys::RIGHT))
	{
		position.x+=Kspeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::LEFT))
	{
		position.x-=Kspeed * deltaTime;
	}
    if(Input_IsKeyDown(Keys::UP))
	{
		position.y-=Kspeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::DOWN))
	{
		position.y+=Kspeed * deltaTime;
	}

	if(Input_IsKeyPressed(Keys::ESCAPE))
	{
		quit=true;
	}
	return quit;
}

void SGE_Render()
{
	sprite.SetPosition(position);
	sprite.Render();
}
